#pragma once
#include "MBLApi.h"
#include <stdint.h>

struct Config
{
	char MBL_IP[32];
	int  MBL_PORT;
	char MBL_USERNAME[32];
	char MBL_PASSWORD[32];

	char REDIS_HOST[32];
	int  REDIS_PORT;
	char REDIS_CONTRACT[256];
	char REDIS_MULTI_QUOTE[64];
	char REDIS_MULTI_QUOTE_CACHE[64];
};

struct Futures_Internal_Book
{
	int  feed_type; /* type of the data source */
	char symbol[64];
	int16_t exchange;
	int  int_time;  /* 090059000, HourMintueSecondMilliSeconds*/
	float pre_close_px;
	float pre_settle_px;
	double pre_open_interest;
	double open_interest;
	float open_px;
	float high_px;
	float low_px;
	float avg_px;
	float last_px;
	float bp_array[5];
	float ap_array[5];
	int  bv_array[5];
	int  av_array[5];
	uint64_t total_vol;
	double total_notional;  /* Trade Notional, Turnover */
	float upper_limit_px;
	float lower_limit_px;
	float close_px;	/* Today's close price */
	float settle_px;
	/* DCE */
	int implied_bid_size[5];  /* Implied Bid/Ask Size */
	int implied_ask_size[5];
	/* Statistics Info, DCE have these from another feed */
	int total_buy_ordsize;		/* Total Open Buy Order Size */
	int total_sell_ordsize;     /* Total Open Sell Order Size */
	float weighted_buy_px;   /* Weighted Buy Order Price */
	float weighted_sell_px;  /* Weighted Sell Order Price */
};

struct Quote
{
	int    int_time;
	double price[2][10];
	int    size[2][10];
};

class MQuoteHandler : public MBLSpi
{
public:
	MQuoteHandler(MBLApi *pMBLApi);
	virtual ~MQuoteHandler();

	virtual void OnMBLConnected();
	virtual void OnMBLRspUserLogin(MBLErrorInfo ErrorInfo);
	virtual void OnMBLRspSubcribe(MBLErrorInfo ErrorInfo);
	virtual void OnMBLRspMarketData(MBLData *pMBLMarketData);

private:
	MBLApi *m_pMBLApi;
};
